package com.NeuglsWorkStudio.UI.FormElement.Component
{
	import com.NeuglsWorkStudio.Colors.HSL;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TConfig;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TLineConfig;
	
	import flash.display.Sprite;

	public class TLine extends TComponent
	{
		private var _FLineSize:Number=1;
		private var _FLineColor:int=0;
		private var _FLine:Sprite;
		
		
		public function TLine(AConfig:TConfig)
		{
			super(AConfig);
		}
		
		public function get LineColor():int
		{
			return _FLineColor;
		}

		public function set LineColor(value:int):void
		{
			_FLineColor = value;
			
			Paint();
		}

		public function get LineSize():Number
		{
			return _FLineSize;
		}

		public function set LineSize(value:Number):void
		{
			_FLineSize = value;
			Paint();
		}

		override protected function Init():void{
			super.Init();
			_FLine=new Sprite();
			this.addChild(_FLine);
			_FLineSize=(_FConfig as TLineConfig).LineSize;
			_FLineColor=(_FConfig as TLineConfig).LineColor;
			Paint();
		}
		
		
		protected function Paint():void{
			var linecolor:HSL=HSL.RGB2HSL(_FLineColor);
			var darkColor:int=new HSL(linecolor.Hue,linecolor.Saturation,linecolor.Luminance-0.15).toRGB().Hex;
			var darkLineSize:Number=1;
			
			with(_FLine.graphics){
				clear();
				
				/*lineStyle(darkLineSize,darkColor,true);
				moveTo(0,0);
				lineTo(0,_FConfig.Height);*/
				
				lineStyle(_FLineSize,_FLineColor,true);
				moveTo(darkLineSize,0);
				lineTo(darkLineSize,_FConfig.Height);
				
				/*lineStyle(darkLineSize,darkColor,true);
				moveTo(darkLineSize+_FLineSize,0);
				lineTo(darkLineSize+_FLineSize,_FConfig.Height);*/
				
				endFill();
			}	
		}
	}
}